package com.loongtech.bi.manager.game;

import com.loongtech.bi.entity.game.EntityMallStatisticsAllNoParam;
import com.loongtech.core.jpa.manager.ManagerQueryCacheBase;
import org.springframework.stereotype.Service;

import java.util.List;
/*
 * 全部商城统计
 */
@Service
public class MallStatisticsAllNoParamManager extends ManagerQueryCacheBase<EntityMallStatisticsAllNoParam> {
	private static final long serialVersionUID = 1L;
	
	public List<Object[]> getMallStatisticsAllByAllKindByReason(String date, String queryPlatform, String queryChannel, String queryServer,String currencytype) {
		return findByQuery("select sumchangenum,rolenum from EntityMallStatisticsAllNoParam  where 1=1 and day= '"+date+"' and currencytype in "+ currencytype +" and platformid = '"+queryPlatform+"' and serverid = '"+queryServer+"' and channelid = '"+queryChannel+"'");
	}

    public List<Object[]> getMallStatisticsAllByAllKindByReason(String date, String queryPlatform, String queryChannel, String queryServer,String currencytype, String reason) {
        return findByQuery("select sumchangenum,rolenum from EntityMallStatisticsAllNoParam  where 1=1 and reason=" + reason + " and day= '"+date+"' and currencytype in "+ currencytype +" and platformid = '"+queryPlatform+"' and serverid = '"+queryServer+"' and channelid = '"+queryChannel+"'");
    }

    public List<Object[]> getMallStatisticsAllByAllKind(String dateStart, String dateEnd, String queryPlatform, String queryChannel, String queryServer,String currencytype) {
        return findByQuery("select sum(sumchangenum),sum(rolenum) from EntityMallStatisticsAllNoParam  where 1=1 and day>= '"+dateStart+"' and day <= '"+dateEnd+"' and currencytype in "+ currencytype +" and platformid = '"+queryPlatform+"' and serverid = '"+queryServer+"' and channelid = '"+queryChannel+"' group by day ");
    }

    public List<Object[]> getMallStatisticsAllByAllKind(String dateStart, String dateEnd, String queryPlatform, String queryChannel, String queryServer,String currencytype, String reason) {
        return findByQuery("select sum(sumchangenum),sum(rolenum) from EntityMallStatisticsAllNoParam  where 1=1 and reason=" + reason + " and day>= '"+dateStart+"' and day <= '"+dateEnd+"' and currencytype in "+ currencytype +" and platformid = '"+queryPlatform+"' and serverid = '"+queryServer+"' and channelid = '"+queryChannel+"' group by day ");
    }
}
